﻿using System.Linq;
using System.Web.Mvc;
using easyccms.BusinessLayer.Repositories;
using easyccms.WebUI.Infrastructure;

namespace easyccms.WebUI.Controllers
{
    /// <summary>
    /// Universal controller that is used for rendering data.
    /// </summary>
    public class UniversalController : Controller
    {
        /// <summary>
        /// Gets the menu repository.
        /// </summary>
        private IMenuRepository MenuRepository
        {
            get { return DependencyInjector.Resolve<IMenuRepository>(); }
        }


        /// <summary>
        /// Renders the container menu.
        /// </summary>
        /// <param name="containerName">Name of the container.</param>
        /// <returns></returns>
        public ActionResult RenderContainerMenu(string containerName)
        {
            return View(MenuRepository.All.Where(x => x.ContainerName == containerName && !x.Deleted));
        }


    }
}
